package cn.lyd.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum ShopStateEnum {
    //店铺状态：1待审核，2审核通过/待激活，3激活成功，4驳回
    AUDIT(1,"待审核"),
    AUDIT_PASS(2,"待激活"),
    ACTIVITY(3,"已激活"),
    AUDIT_NO_PASS(4,"4驳回");


    public static String getNameByCode(Integer code){
        Optional<ShopStateEnum> first = Arrays.stream(ShopStateEnum.values()).filter(state -> state.getCode() == code)
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private int code;

    private String name;
}
